home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 25 / Cream of the Crop 25.iso / program / ny_src.zip / IBBSNY.H < prev    next >
C/C++ Source or Header  |  1997-04-22  |  5KB  |  164 lines

  1. #ifndef INTERBBS_H
  2. #define INTERBBS_H
  3.  
  4. /******************************************************************************/
  5. /*                           Configuration Constants                              */
  6. /******************************************************************************/
  7. /*#define PROG_NAME_CHARS    35
  8. #define PATH_CHARS         80
  9. #define FILENAME_CHARS     12
  10. #define MESSAGE_SUBJECT    "##NY2008 v0.10 IBBS Door Message"
  11. #define MESSAGE_PID        "\1PID: ODIBMS 1\r"
  12. #define MAX_LINE_LENGTH    70
  13. #define MESSAGE_HEADER     "$"
  14. #define MESSAGE_FOOTER     "$"
  15. #define DELIMITER_CHAR     '$'
  16. #define NODE_ADDRESS_CHARS 23
  17. #define SYSTEM_NAME_CHARS  40
  18. #define LOCATION_CHARS     40*/
  19.  
  20. /******************************************************************************/
  21. /*                                  Data Types                                  */
  22. /******************************************************************************/
  23. #ifndef tBool
  24. typedef int tBool;
  25. #endif
  26. #ifndef FALSE
  27. #define FALSE 0
  28. #endif
  29. #ifndef TRUE
  30. #define TRUE 1
  31. #endif
  32.  
  33. /*#ifndef WORD
  34. typedef unsigned int WORD;
  35. #endif
  36.  
  37. #ifndef DWORD
  38. typedef unsigned long DWORD;
  39. #endif*/
  40.  
  41. //#endif
  42.  
  43. typedef enum
  44.    {
  45.    eSuccess,
  46.    eNoMoreMessages,
  47.    eGeneralFailure,
  48.    eBadParameter,
  49.    eNoMemory,
  50.    eMissingDir,
  51.    eFileOpenError
  52.    } tIBResult;
  53.  
  54. typedef struct
  55.    {
  56.    char szAddress[NODE_ADDRESS_CHARS + 1];
  57.    char szSystemName[SYSTEM_NAME_CHARS + 1];
  58.    char szLocation[LOCATION_CHARS + 1];
  59.    } tOtherNode;
  60.  
  61. typedef struct
  62.    {
  63.    char szThisNodeAddress[NODE_ADDRESS_CHARS + 1];
  64.    char szProgName[PROG_NAME_CHARS + 1];
  65.    char szNetmailDir[PATH_CHARS + 1];
  66.    tBool bCrash;
  67.    tBool bHold;
  68.    tBool bEraseOnSend;
  69.    tBool bEraseOnReceive;
  70.    int nTotalSystems;
  71.    tOtherNode *paOtherSystem;
  72.    } tIBInfo;
  73.  
  74.  
  75. /******************************************************************************/
  76. /*                         InterBBS API Functions                             */
  77. /******************************************************************************/
  78. tIBResult IBSend(tIBInfo *pInfo, char *pszDestNode, char *pBuffer,
  79.          int nBufferSize);
  80.  
  81. tIBResult IBSendAll(tIBInfo *pInfo, char *pBuffer, int nBufferSize);
  82. //tIBResult IBGet(tIBInfo *pInfo, void *pBuffer, int nMaxBufferSize);
  83. tIBResult IBSendMail(tIBInfo *pInfo, ibbs_mail_type *ibmail);
  84. tIBResult IBGetMail(tIBInfo *pInfo, ibbs_mail_type *ibmail);
  85. //tIBResult IBGetR(tIBInfo *pInfo, void *pBuffer,int *nBufferLen);
  86. tIBResult IBReadConfig(tIBInfo *pInfo, char *pszConfigFile);
  87.  
  88.  
  89. /******************************************************************************/
  90. /*                             Private Declarations                              */
  91. /******************************************************************************/
  92. typedef struct
  93.    {
  94.    char szFromUserName[36];
  95.    char szToUserName[36];
  96.    char szSubject[72];
  97.    char szDateTime[20];         /* "DD Mon YY  HH:MM:SS" */
  98.    WORD wTimesRead;
  99.    WORD wDestNode;
  100.    WORD wOrigNode;
  101.    WORD wCost;                    /* Lowest unit of originator's currency */
  102.    WORD wOrigNet;
  103.    WORD wDestNet;
  104.    WORD wDestZone;
  105.    WORD wOrigZone;
  106.    WORD wDestPoint;
  107.    WORD wOrigPoint;
  108.    WORD wReplyTo;
  109.    WORD wAttribute;
  110.    WORD wNextReply;
  111.    } tMessageHeader;
  112.  
  113. #define ATTRIB_PRIVATE        0x0001
  114. #define ATTRIB_CRASH        0x0002
  115. #define ATTRIB_RECEIVED     0x0004
  116. #define ATTRIB_SENT         0x0008
  117. #define ATTRIB_FILE_ATTACH    0x0010
  118. #define ATTRIB_IN_TRANSIT    0x0020
  119. #define ATTRIB_ORPHAN        0x0040
  120. #define ATTRIB_KILL_SENT    0x0080
  121. #define ATTRIB_LOCAL        0x0100
  122. #define ATTRIB_HOLD         0x0200
  123. #define ATTRIB_FILE_REQUEST 0x0800
  124. #define ATTRIB_RECEIPT_REQ    0x1000
  125. #define ATTRIB_IS_RECEIPT    0x2000
  126. #define ATTRIB_AUDIT_REQ    0x4000
  127. #define ATTRIB_FILE_UPDATE    0x8000
  128.  
  129. typedef struct
  130.    {
  131.    WORD wZone;
  132.    WORD wNet;
  133.    WORD wNode;
  134.    WORD wPoint;
  135.    } tFidoNode;
  136.  
  137.  
  138. //tBool DirExists(const char *pszDirName);
  139. void MakeFilename(const char *pszPath, const char *pszFilename, char *pszOut);
  140. tIBResult ValidateInfoStruct(tIBInfo *pInfo);
  141. tBool CreateMessage(char *pszMessageDir, tMessageHeader *pHeader,
  142.                     char *pszText);
  143. DWORD GetFirstUnusedMsgNum(char *pszMessageDir);
  144. void GetMessageFilename(char *pszMessageDir, DWORD lwMessageNum,
  145.                         char *pszOut);
  146. tBool WriteMessage(char *pszMessageDir, DWORD lwMessageNum,
  147.                    tMessageHeader *pHeader, char *pszText);
  148. tBool ReadMessage(char *pszMessageDir, DWORD lwMessageNum,
  149.                   tMessageHeader *pHeader, char **ppszText);
  150. DWORD GetNextMSGID(void);
  151. int GetMaximumEncodedLength(int nUnEncodedLength);
  152. void EncodeBuffer(char *pszDest, const char *pBuffer, int nBufferSize);
  153. //void DecodeBuffer(const char *pszSource, void *pDestBuffer, int nBufferSize);
  154. void EncodeMail(char *pszDest, ibbs_mail_type *ibmail);
  155. void DecodeMail(const char *pcSource, ibbs_mail_type *ibmail);
  156. //int DecodeBufferR(const char *pszSource, void *pDestBuffer);
  157. void ConvertAddressToString(char *pszDest, const tFidoNode *pNode);
  158. void ConvertStringToAddress(tFidoNode *pNode, const char *pszSource);
  159. tBool ProcessConfigFile(char *pszFileName, int nKeyWords, char **papszKeyWord,
  160.           void (*pfCallBack)(int, char *, void *), void *pCallBackData);
  161. void ProcessConfigLine(int nKeyword, char *pszParameter, void *pCallbackData);
  162.  
  163. #endif
  164.